﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="TaskView.aspx.cs" Inherits="TaskView" Title="实验任务列表" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
<h1 id="pagetitle" class="pagetitle">
        检验任务
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <div class="anistyle" id="ani">
                    正在加载数据，请耐心等待...
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </h1>
    <script type="text/javascript">
    
//上传原始记录文件
function InvokePop(co_item_id)
{
      var url='uploadfile2.aspx?co_testitem_xls&pccid='+'<%=this.btnHiddenAddTRFile.ClientID%>'+'&co_item_id='+co_item_id;

      window.open(url,'上传','height=400,width=600,resizable=yes');

         
}
//上传报告文件
function InvokePopUploadFinalReport(report_id)
{
    var url= 'uploadfile2.aspx?report&pccid='+'<%=this.BtnUploadReportHidden.ClientID%>'+'&id='+report_id ;
    window.open(url,'上传','height=400,width=600,resizable=yes');                
  
}

//下载模板
function InvokePopDownloadTemplate(item_code,co_item_id)
{
        // to handle in IE 7.0          
        if (window.showModalDialog)
        {      
            retVal = window.showModalDialog("TestItemTemplate.aspx?item_code=" + item_code  ,'下载原始记录模板(Excel格式)',"dialogHeight:400px;dialogWidth:600px;resizable:no;center:yes;");
            
        }
        // to handle in Firefox
        else
        {     
            retVal = window.open("TestItemTemplate.aspx?item_code=" + item_code  ,'下载原始记录模板(Excel格式)','height=400,width=600,resizable=yes,modal=yes');
                 
        }  
       // window.location.href=window.location.pathname+"?co_item_id="+co_item_id;     
         return true;
}


function InvokePopSelectAuditor(report_id)
{
  // to handle in IE 7.0          
        if (window.showModalDialog)
        {      
            retVal = window.showModalDialog("SelectAuditors.aspx?report_id=" + report_id  ,'选择审批人',"dialogHeight:600px;dialogWidth:800px;resizable:no;center:yes");
            
        }
        // to handle in Firefox
        else
        {     
            retVal = window.open("SelectAuditors.aspx?report_id=" + report_id  ,'选择审批人','height=600px,width=800px,resizable=yes,modal=yes');
                 
        }  
       // window.location.href=window.location.pathname+"?co_item_id="+co_item_id;     
         return true;
}




    </script>

    <div id="contractList">
        <strong>合同列表</strong>
        <asp:GridView ID="GridViewContracts" runat="server" CellPadding="4" ForeColor="#333333"
            GridLines="None" AutoGenerateColumns="False" DataKeyNames="Report_ID" OnRowDataBound="GridViewContracts_RowDataBound"
            OnSelectedIndexChanged="GridViewContracts_SelectedIndexChanged">
            <RowStyle BackColor="#E3EAEB" />
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#7C6F57" />
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="Report_ID" HeaderText="报告编号" />
                <asp:BoundField DataField="Corp_Name" HeaderText="客户单位" />
                <asp:BoundField DataField="Report_Status_Text" HeaderText="状态" />
                <asp:BoundField DataField="Create_Time" DataFormatString="{0:d}" HeaderText="创建时间" />
                <asp:CommandField ButtonType="Button" ShowSelectButton="True" />
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="BtnStartContract" runat="server" CausesValidation="false" CommandName="Start"
                            OnClick="BtnStartContract_Click" Text="开始" ToolTip="开始执行实验。注意：任何实验组开始执行实验，都会将改变合同的状态为“检验中”。" />
                        &nbsp;&nbsp;&nbsp;
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <hr />
    
    <asp:Panel ID="PanelContractTask" runat="server" Width="100%" Visible="false">
    <div id="testItemList">
        <strong>
            <asp:Label ID="LabelContractId" runat="server"></asp:Label>
            &nbsp;检验项列表</strong>
         <div>
            <small>**当所有的检验项均完成，则该合同的状态会自动变更为【实验完成】。</small>
        </div>
        <asp:GridView ID="GridViewTestItems" runat="server" CellPadding="4" ForeColor="#333333"
            GridLines="None" AutoGenerateColumns="False" DataKeyNames="Co_Item_ID" OnRowDataBound="GridViewTestItems_RowDataBound">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="Item_Code" HeaderText="检验项代码" />
                <asp:BoundField DataField="Item_Title" HeaderText="检验项名称" />
                <asp:BoundField DataField="Test_Status_Text" HeaderText="执行状态" />
                <asp:BoundField DataField="Last_Status_Time" DataFormatString="{0:d}" HeaderText="更新时间" />
                <asp:TemplateField HeaderText="开始" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="BtnStartTestItem" runat="server" CausesValidation="false" OnClick="BtnStartTestItem_Click"
                            Text="开始" />                                        
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                    <HeaderStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="下载模板">
                    <ItemTemplate>
                         <%-- 使用服务器端代码在绑定每行时添加了JavaScript Pop调用--%>
                        <asp:Button ID="btnDownload" runat="server" Text="下载" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="上传原始记录">
                    <ItemTemplate>
                        <asp:Button ID="btnUpload" runat="server" Text="上传"/>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="完成">
                <ItemTemplate>
                 <asp:Button ID="BtnEndTestItem" runat="server" CausesValidation="false" CommandName="End"
                            OnClick="BtnEndTestItem_Click" Text="完成" OnClientClick='return confirm("完成该项之后则不能再为此检验项上传原始记录文件！您确认完成了该检验项吗?");' />
                </ItemTemplate>
                
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <div id="testRecordFilesList">
        <strong>
            <asp:Label ID="LabelContractId2" runat="server"></asp:Label>
            &nbsp;原始记录文件列表</strong>
        <div>
            <small>**报告片段文件根据原始记录Excel自动生成，若上传的文件非原始记录Excel，则没有对应的报告片段。</small>
        </div>
        <asp:GridView ID="GridViewTestRecords" runat="server" AutoGenerateColumns="False"
            BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px"
            CellPadding="3" DataKeyNames="TR_ID" GridLines="Vertical" OnRowDeleting="GridViewTestRecords_RowDeleting">
            <Columns>
                <asp:BoundField DataField="Item_Code" HeaderText="检验项代码" />
                <asp:BoundField DataField="TR_ID" HeaderText="原始记录编号" />
                <asp:HyperLinkField DataNavigateUrlFields="TR_URL" DataNavigateUrlFormatString="getfile.aspx?fileid={0}"
                    HeaderText="原始记录文件" Target="_blank" DataTextField="Xls_Name" />
                <asp:HyperLinkField DataNavigateUrlFields="Report_Slice_URL" DataNavigateUrlFormatString="getfile.aspx?fileid={0}"
                    DataTextField="Doc_Name" HeaderText="报告片段文件" Target="_blank" />
                <asp:CommandField  DeleteText="&lt;span onclick=&quot;JavaScript:return confirm('您确认删除该原始记录文件吗?')&quot;&gt;删除&lt;/span&gt; "
                    ShowDeleteButton="True" />
            </Columns>
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="Gainsboro" />
        </asp:GridView>
        <asp:Button ID="btnHiddenAddTRFile" Text="" runat="server" style="display:none" OnClick="btnHiddenAddTRFile_Click" />
        <br />
        <asp:Panel ID="PanelReport" runat="server"  Width="100%">
           <span><strong>最终报告：</strong><asp:HyperLink ID="HyperLinkReport" runat="server"></asp:HyperLink>
               &nbsp; &nbsp;&nbsp;
           <asp:Button ID="BtnDeleteReport" runat="server" Text="删除" OnClientClick='return confirm("您确认删除该最终报告文件吗?提示：仅当您要重新上传最终报告文件时才删除。");' OnClick="BtnDeleteReport_Click"  />
           &nbsp;&nbsp;<asp:Button ID="BtnUploadReport" runat="server" Text="上传" /> 
           <asp:Button ID="BtnUploadReportHidden" Text="" runat="server" style="display:none" OnClick="BtnUploadReport_Click" />
       
           </span>      
           <br />   <br />   
           <span><strong>上报审批：</strong> 
               <%--这里弹出窗口选择了审批人，审批人拼接为字符串，赋值给HyperLinkAuditors。单击link弹出窗口显示审批人列表--%>
              <asp:Label ID="LabelAuditors" runat="server"></asp:Label>
               &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
               <asp:Button ID="BtnSelectAuditor" runat="server" Text="设定审批人" OnClick="BtnSelectAuditor_Click" /></span>   
               <br />  
        </asp:Panel>
        <br />
        <asp:Panel ID="PanelConfirm" runat="server"  Width="100%">
        <span><strong>报告审核：</strong> 
            <asp:Button ID="BtnConfirm1" runat="server" Text="专家同意"  OnClientClick='return confirm("您确认同意此报告吗？");'/> 
            &nbsp;&nbsp;
            <asp:Button ID="ButtonLastConfirm" runat="server" Text="站长同意" OnClientClick='return confirm("最终确认的报告将成为发布给客户的文件。您确认批准此报告吗？");'/> 
            &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;
            <asp:Button ID="BtnRefuse" runat="server" Text="否决" BackColor="Red" OnClientClick='return confirm("否决的报告需要重新确定实验内容，报告将回到【待实验状态】。您确认否决此报告吗？");' />
             </span>
        </asp:Panel>
    </div>
    </asp:Panel>
</asp:Content>
